home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / LTP_GetDisplayClip.c < prev    next >
C/C++ Source or Header  |  1996-03-18  |  1KB  |  66 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. VOID
  15. LTP_GetDisplayClip(struct Screen *screen,WORD *left,WORD *top,WORD *width,WORD *height)
  16. {
  17.     struct TagItem tags[2] = { VTAG_VIEWPORTEXTRA_GET, NULL, TAG_DONE };
  18.  
  19.     if(!VideoControl(screen->ViewPort.ColorMap,tags))
  20.     {
  21.         struct ViewPortExtra    *vpe = (struct ViewPortExtra *)tags[0].ti_Data;
  22.         struct Rectangle         clip;
  23.  
  24.         QueryOverscan(GetVPModeID(&screen->ViewPort),&clip,OSCAN_TEXT);
  25.  
  26.         *width    = vpe->DisplayClip.MaxX - vpe->DisplayClip.MinX + 1;
  27.         *height = vpe->DisplayClip.MaxY - vpe->DisplayClip.MinY + 1;
  28.  
  29.         if(*width < clip.MaxX - clip.MinX + 1)
  30.             *width = clip.MaxX - clip.MinX + 1;
  31.  
  32.         if(*height < clip.MaxY - clip.MinY + 1)
  33.             *height = clip.MaxY - clip.MinY + 1;
  34.  
  35.         if(*width > screen->Width)
  36.             *width = screen->Width;
  37.  
  38.         if(*height > screen->Height)
  39.             *height = screen->Height;
  40.     }
  41.     else
  42.     {
  43.         *width    = screen->Width;
  44.         *height = screen->Height;
  45.     }
  46.  
  47.     *left = screen->LeftEdge;
  48.     *top  = screen->TopEdge;
  49.  
  50.     if(*left > 0)
  51.         *left = 0;
  52.     else
  53.         *left = -(*left);
  54.  
  55.     if(*top > 0)
  56.         *top = 0;
  57.     else
  58.         *top = -(*top);
  59.  
  60.     if((*left > screen->Width) || (*left < 0))
  61.         *left = 0;
  62.  
  63.     if ((*top > screen->Height) || (*top < 0))
  64.         *top = 0;
  65. }
  66.